import 'dart:math' as math;

import 'package:url_launcher/url_launcher_string.dart';

class ChartDemoState {
  // title
}

class ChartUtils {
  factory ChartUtils() {
    return _singleton;
  }

  ChartUtils._internal();
  static final ChartUtils _singleton = ChartUtils._internal();

  double degreeToRadian(double degree) {
    return degree * math.pi / 180;
  }

  double radianToDegree(double radian) {
    return radian * 180 / math.pi;
  }

  Future<bool> tryToLaunchUrl(String url) async {
    if (await canLaunchUrlString(url)) {
      return await launchUrlString(url);
    }
    return false;
  }
}
